import { createApp } from 'vue'
// 首先引入自定义 reset.css
import './assets/css/reset.css'
// 然后引入其他 CSS
import './style.css'
import 'ant-design-vue/dist/reset.css'

import App from './App.vue'
import router from './router'
import pinia from './store'
import Antd from 'ant-design-vue'
import { antdTheme } from './theme'
import { ConfigProvider } from 'ant-design-vue';

// 导入中文语言包
import zhCN from 'ant-design-vue/es/locale/zh_CN';

// 添加图标引入
import {
  UserOutlined,
  HomeOutlined,
  DashboardOutlined,
  CarOutlined,
  PlusOutlined,
  SearchOutlined,
  EditOutlined,
  DeleteOutlined,
  ImportOutlined,
  DownloadOutlined,
  InboxOutlined,
  FileOutlined
} from '@ant-design/icons-vue';

const app = createApp(App)

// 使用插件
app.use(pinia)
app.use(router)
app.use(Antd, {
  // 设置全局组件大小
  size: 'large',
  // 设置为中文
  locale: zhCN
})

// 全局配置
app.config.globalProperties.$theme = {
  primaryColor: '#0095FF',
  secondaryColor: '#0000C9'
};

// 提供中文配置
app.provide('locale', zhCN);

// 设置 Ant Design Vue 的主题
app.component('ConfigProvider', ConfigProvider);
app.provide('theme', antdTheme);

// 注册图标组件
const icons = {
  UserOutlined,
  HomeOutlined,
  DashboardOutlined,
  CarOutlined,
  PlusOutlined,
  SearchOutlined,
  EditOutlined,
  DeleteOutlined,
  ImportOutlined,
  DownloadOutlined,
  InboxOutlined,
  FileOutlined
};

// 添加所有图标到全局组件
Object.keys(icons).forEach(name => {
  app.component(name, icons[name]);
});

app.mount('#app')
